#define _CRT_SECURE_NO_WARNINGS
#include"SList.h"

void SlistTest01()
{
	SLTNode* node1 = (SLTNode*)malloc(sizeof(SLTNode));
	node1->data = 1;
	SLTNode* node2 = (SLTNode*)malloc(sizeof(SLTNode));
	node2->data = 2;
	SLTNode* node3 = (SLTNode*)malloc(sizeof(SLTNode));
	node3->data = 3;
	SLTNode* node4 = (SLTNode*)malloc(sizeof(SLTNode));
	node4->data = 4;

	node1->nest = node2;
	node2->nest = node3;
	node3->nest = node4;
	node4->nest = NULL;

	SLTNode* plist = node1;
	SLTPrint(plist);

}
void SlistTest02()
{
	SLTNode* plist = NULL;
	SLTPushBack(&plist, 1);
	SLTPushBack(&plist, 2);
	SLTPushBack(&plist, 3);
	SLTPushBack(&plist, 4);
	SLTPrint(plist);
	//SLTPushBack(NULL, 5);
	//SLTPrint(plist);
	//SLTPushFront(&plist, 5);
	//SLTPushFront(&plist, 6);
	//SLTPushFront(&plist, 7);
	//SLTPrint(plist);
	SLTPopBack(&plist);
	SLTPrint(plist);
	SLTPopBack(&plist);
	SLTPrint(plist);
	SLTPopBack(&plist);
	SLTPrint(plist);
	SLTPopBack(&plist);
	SLTPrint(plist);
}
void SlistTest03()
{
	SLTNode* plist = NULL;
	SLTPushBack(&plist, 1);
	SLTPushBack(&plist, 2);
	SLTPushBack(&plist, 3);
	SLTPushBack(&plist, 4);
	SLTPrint(plist);
	SLTNode* FindRet = SLTFind(&plist, 3);
	SLTInsertAfter(FindRet, 100);
	SLTPrint(plist);
	//SLTInsert(&plist, FindRet, 100);
	//SLTPrint(plist);
	////SLTNode* FindRet = SLTFind(&plist, 5);
	//SLTInsert(&plist, FindRet, 200);
	//SLTPrint(plist);
	SLTErase(&plist, FindRet);
	SLTPrint(plist);
}
int main()
{
	//SlistTest01();
	//SlistTest02();
	SlistTest03();
	return 0;
}
